package h_eekwan.basic;

public class Test74 {
	public static void main(String[] args) {
		// 은행 계좌를 나타내는 Account 클래스작성
		// 계좌번호를 위한 aid변수, 초기값 0
		// 통잔잔액 balance 변수 초기값 0
		// 연간 이자율 interestRate 변수, 초기값 0
		// 통장개설 날짜를 위한 dateCreated 변수
		// 월간 이자율 getMonthlyInterestRate 메서드
		Account ac = new Account(3022040, 120000, 5.0, "2014-07-30");
		System.out.println("월간 이자율 : " + ac.getMonthlyInterestRate(ac));
		System.out.println(ac.toString());
		
		HeeAccount hee = new HeeAccount(302, 1900000, 6.0, "2014-08-15");
		System.out.println("희님의 월간 이자율 : " + hee.getMonthlyInterestRate(hee));
		System.out.println(hee.toString());
	}
}
interface AccountService{
	public double getMonthlyInterestRate(Account ac);
		
	
}
class Account implements AccountService{
	private int aid;
	private int balance;
	private double interestRate;
	private String dateCreated;
	
	
	public Account(){
		aid = 0;
		balance = 0;
		interestRate = 0;
	}

	public Account(int aid, int balance, double interestRate,
			String dateCreated) {
		
		this.aid = aid;
		this.balance = balance;
		this.interestRate = interestRate;
		this.dateCreated = dateCreated;
		
	}

	public int getAid() {
		return aid;
	}

	public void setAid(int aid) {
		this.aid = aid;
	}

	public int getBalance() {
		return balance;
	}

	public void setBalance(int balance) {
		this.balance = balance;
	}

	public double getInterestRate() {
		return interestRate;
	}

	public void setInterestRate(double interestRate) {
		this.interestRate = interestRate;
	}

	public String getDateCreated() {
		return dateCreated;
	}

	public void setDateCreated(String dateCreated) {
		this.dateCreated = dateCreated;
	}

	@Override
	public double getMonthlyInterestRate(Account ac) {
		
		return (double)getBalance() * (getInterestRate()/12)  ;
	}

	@Override
	public String toString() {
		return "은행계좌정보 [ 통장계좌 = " + aid + ",통잔잔액 = " + balance
				+ " 연간 이자율 = " + interestRate + ", 통장개설날짜 = "
				+ dateCreated + " ]";
	}
	

	
	
}
class HeeAccount extends Account implements AccountService{
	public HeeAccount(int a, int b, double rate, String date){
		super(a,b,rate,date);
		
	}
	
}